<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>upload</title>
</head>

    <body>
    <form method="post">
    <ui>
        <li>
           当前客户端 {{ user }}，请上传分数：<input type="text" id="score" name="score" placeholder="可输入范围：1~10000000。"> 分。
        </li>
        <li>
            <input name="" type="button" value="提交" onclick="return sub()"/>
        </li>
        <li>
            <a href="/logout/"><input name="" type="button" value="退出"/></a>
        </li>
        <li>
            <a href="{% url 'play:show' %}"><input name="" type="button" value="查询"/></a>
        </li>

        <div id="score_err" style="color: red;"></div>
        <div id="score_err" style="color: red;"></div>
    </ui>


</form>
&nbsp;&nbsp;

&nbsp;&nbsp;




</body>


<script language="JavaScript" src="/static/js/jquery-1.12.4.min.js"></script>
<script language="JavaScript" src="/static/js/axios-0.18.0.min.js"></script>
<script language="JavaScript" src="/static/js/vue-2.5.16.js"></script>
<script language="JavaScript" src="/static/js/common.js"></script>
<script type="text/javascript">
 function sub() {
        var score = $('#score').val();
        var flag = true;
        if (score < 1 || score > 10000000) {
            $('#score_err').text('分数不符合规范！');
            flag = false;
        }
        if (flag) {
            $.ajax({
                url: '/login/',
                data: {'score': score},
                type: 'POST',
                success: function (result) {
                    alert(result.status)
                }
            })
        }
        return flag;
    }


</script>
</html>